package controller;

import java.awt.event.KeyEvent;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

import view.overlay.ScrollingTextOverlay;

public class CreditsController extends Controller {
	
	private ScrollingTextOverlay mOverlay;
	
	private GameControl mImmediatelyShowCreditsControl;
	
	public CreditsController(ScrollingTextOverlay sto) {
		mOverlay = sto;
		
		mOverlay.loadTextFromFile(new File("res/other/credits.txt"));
		mOverlay.setVisible(false);
		
		mImmediatelyShowCreditsControl = new GameControl(KeyEvent.VK_F7, "SHOW_CREDITS", "Cheat: Show Credits Immedately") {
			@Override
			public void execute() {
				rollCredits();
			}
		};
		mImmediatelyShowCreditsControl.setReassignable(false);
		
	}
	
	
	public void rollCredits() {
		mOverlay.setVisible(true);
		mOverlay.start();
		
		MidiPlayer mPlayer = MidiPlayer.getInstance();
		mPlayer.playMidi(new File("res/audio/credits.mid"));
	}


	@Override
	public List<GameControl> getKeyControls() {
		
		
		List<GameControl> list = new ArrayList<GameControl>();
		
		list.add(mImmediatelyShowCreditsControl);
		
		return (list);
	}

	@Override
	public void reset() {
		mOverlay.setVisible(false);
	}
}
